import telebot
from thisapidoesnotexist import get_person
import requests
import time
import os
import random

print("Bot started ;)")
x = 1
y = 1
bot = telebot.TeleBot('***************************************************')


def getRandomFile(path):
  files = os.listdir(path)
  index = random.randrange(0, len(files))
  return files[index]

keyboard1 = telebot.types.ReplyKeyboardMarkup(True)
keyboard1.row('/foto')

@bot.message_handler(commands=['start'])
def start_message(message):
    bot.send_message(message.chat.id, 'Привет,  этот бот присылает фото пропущенный через нейронку  fawkes', reply_markup=keyboard1)
    
@bot.message_handler(commands=['foto'])
def foto_message(message):
    print("I working")
    filename = getRandomFile("/home/****/fawkes/foto/")
    img = open( "/home/****/fawkes/foto/" + filename, 'rb')
    bot.send_message(message.chat.id, str(filename))
    bot.send_photo(message.chat.id, img)
    os.remove("/home/****/fawkes/foto/" + filename)
    
    
 

bot.polling()